using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BootyBay.Models.Mapping
{
    public class AllApplicationMap : EntityTypeConfiguration<AllApplication>
    {
        public AllApplicationMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Id, t.ApplicationName, t.MajorVersion, t.Status, t.CreationDate, t.OperationDate, t.IsHidden, t.IsRecommended, t.IsPublicApp, t.Id_ApplicationVersion, t.StoreHttpUrl, t.IdentityName, t.Version, t.Publisher, t.DisplayName, t.PublisherDisplayName, t.ChangeLog, t.Category, t.SubcategoryText, t.VersionOperationDate });

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.ApplicationName)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.MajorVersion)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.Status)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Id_ApplicationVersion)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.StoreHttpUrl)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.IdentityName)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.Version)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.Publisher)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.DisplayName)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.PublisherDisplayName)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.Description)
                .HasMaxLength(500);

            this.Property(t => t.ChangeLog)
                .IsRequired();

            this.Property(t => t.Category)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.CategoryText)
                .HasMaxLength(500);

            this.Property(t => t.SubcategoryText)
                .IsRequired()
                .HasMaxLength(1);

            this.Property(t => t.LogoUrl_Store)
                .HasMaxLength(500);

            this.Property(t => t.LogoUrl_150x150)
                .HasMaxLength(500);

            this.Property(t => t.LogoUrl_30x30)
                .HasMaxLength(500);

            this.Property(t => t.LogoUrl_310x150)
                .HasMaxLength(500);

            this.Property(t => t.LogoUrl_310x310)
                .HasMaxLength(500);

            this.Property(t => t.LogoUrl_70x70)
                .HasMaxLength(500);

            this.Property(t => t.ProtocolUrl)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("AllApplication");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.ApplicationName).HasColumnName("ApplicationName");
            this.Property(t => t.MajorVersion).HasColumnName("MajorVersion");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.CreationDate).HasColumnName("CreationDate");
            this.Property(t => t.OperationDate).HasColumnName("OperationDate");
            this.Property(t => t.IsHidden).HasColumnName("IsHidden");
            this.Property(t => t.IsRecommended).HasColumnName("IsRecommended");
            this.Property(t => t.IsPublicApp).HasColumnName("IsPublicApp");
            this.Property(t => t.Id_ApplicationVersion).HasColumnName("Id_ApplicationVersion");
            this.Property(t => t.StoreHttpUrl).HasColumnName("StoreHttpUrl");
            this.Property(t => t.IdentityName).HasColumnName("IdentityName");
            this.Property(t => t.Version).HasColumnName("Version");
            this.Property(t => t.Publisher).HasColumnName("Publisher");
            this.Property(t => t.ProcessorArchitecture).HasColumnName("ProcessorArchitecture");
            this.Property(t => t.DisplayName).HasColumnName("DisplayName");
            this.Property(t => t.PublisherDisplayName).HasColumnName("PublisherDisplayName");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Keywords).HasColumnName("Keywords");
            this.Property(t => t.ChangeLog).HasColumnName("ChangeLog");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.CategoryText).HasColumnName("CategoryText");
            this.Property(t => t.Subcategory).HasColumnName("Subcategory");
            this.Property(t => t.SubcategoryText).HasColumnName("SubcategoryText");
            this.Property(t => t.LogoUrl_Store).HasColumnName("LogoUrl_Store");
            this.Property(t => t.LogoUrl_150x150).HasColumnName("LogoUrl_150x150");
            this.Property(t => t.LogoUrl_30x30).HasColumnName("LogoUrl_30x30");
            this.Property(t => t.LogoUrl_310x150).HasColumnName("LogoUrl_310x150");
            this.Property(t => t.LogoUrl_310x310).HasColumnName("LogoUrl_310x310");
            this.Property(t => t.LogoUrl_70x70).HasColumnName("LogoUrl_70x70");
            this.Property(t => t.ProtocolUrl).HasColumnName("ProtocolUrl");
            this.Property(t => t.ScreenshotUrls).HasColumnName("ScreenshotUrls");
            this.Property(t => t.VersionOperationDate).HasColumnName("VersionOperationDate");
        }
    }
}
